<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>维修历史</title>
    <link href="../../../css/common.css" rel="stylesheet"/>
    <link href="../../../css/mui.min.css" rel="stylesheet"/>
    <link href="../../../css/order/dispatcher/orderHistory.css" rel="stylesheet"/>
    <script src="../../../js/vue.min.js"></script>
    <script src="../../../js/mui.min.js"></script>
    <script src="../../../js/fastclick.js"></script>
    <script src="../../../js/api.js"></script>
    <script src="../../../js/common.js"></script>
    <script src="../../../js/vue-common.js"></script>
    <script src="../../../js/vue-compents/dispatcher.js"></script>
</head>
<body>
<div id="app">
    <div class="header-nav">
        <span>维修历史</span>
        <div class="icon"><img src="../../../img/common/btn_back.png" alt=""></div>
    </div>

    <div class="container his-container">
        <div class="ls-card-box" v-for="item of list">
            <div class="order-his-outer">
                <div class="card-item">
                    <div class="order-his-title">报修时间：</div>
                    <div class="order-his-text">{{item.beginDate |dataFormat}}</div>
                </div>
                <div class="card-item">
                    <div class="order-his-title">完成时间：</div>
                    <div class="order-his-text">{{item.beginDate |dataFormat}}</div>
                </div>
                <div class="card-item">
                    <div class="order-his-title">故障描述：</div>
                    <div class="order-his-text">{{item.startUnDesc}}</div>
                </div>
                <div class="card-item">
                    <div class="order-his-title">维修反馈：</div>
                    <div class="order-his-text">{{item.fixDescribe}}</div>
                </div>
            </div>
            <user-mir-info-card :data-info="buildEngList(item)"></user-mir-info-card>
        </div>

        <div v-if="list.length <= 0" class="order-his-no-data">
           --暂无维修记录--
        </div>
    </div>
</div>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            atmId:'',
            list:[],
        },
        methods: {
            initList:function () {
                Resource.get(DISPATCHER_DEVICE_FIX_HISTORY_LIST, {pageNo: 1, pageSize: 1000, atmId: this.atmId }, function (res) {
                    vm.list = res.list;
                })
            }
        }

    });

    function buildEngList(data){
        var result =[];
        if( data.engineerFName){
            result.push({
                icon: data.engineerFIcon,
                deptName: data.engineerFDeptName,
                engName:  data.engineerFName,
                engPhone: data.engineerFPhone,
            })
        }
        if( data.engineerSName){
            result.push({
                icon: data.engineerSIcon,
                deptName: data.engineerSDeptName,
                engName:  data.engineerSName,
                engPhone: data.engineerSPhone,
            })
        }
        return result;
    }
    mui.plusReady(function () {
        var self = plus.webview.currentWebview();
        var atmId = self.atmId;
        if (atmId == '' || atmId == 'undefined') {
            return;
        }
        vm.atmId = atmId;
        console.log('listen ----------atmId =' + atmId);
        vm.initList();

    })

</script>
</body>
</html>